package jiejie.qiye;

import java.util.Scanner;

public class baidu {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int y=sc.nextInt();
        sc.nextLine();
        String order=sc.nextLine();
        getRes(x,y,order);

    }
    public static void getRes(int x, int y, String order){
        if(order.length()==0){
            System.out.println(x+" "+y);
        }
        for(int i=0; i<order.length(); i++){
            if(order.charAt(i)=='L')
                x--;
            if(order.charAt(i)=='R')
                x++;
            if(order.charAt(i)=='U')
                y++;
            if(order.charAt(i)=='D')
                y--;
        }
        System.out.println(x+" "+y);
    }
}
